/**
 * PackageDir: info.javafans.cdn.web.action
 * FileName: ShowSingleGroupAction.java
 * CreateDate: 2011-3-6 下午06:04:19
 * Copyright: Copyright (c) 2011 <br />
 * Company: fossd <br />
 * @author Yintao Xue
 * @version 1.0 2011-3-6
 */
package info.javafans.cdn.web.action;

import info.javafans.cdn.dao.GroupDao;
import info.javafans.cdn.dao.GroupTypeDao;
import info.javafans.cdn.domain.Group;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Project: CollegeDatingNetwork <br />
 * ClassName: ShowSingleGroupAction <br />
 * Description:  <br />
 */
public class ShowSingleGroupAction extends Action {

	@Override
	public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
	String id = request.getParameter("id");
		
		if (id == null) {
			return "error";
		}
		ShowIndexAction.prepareDate(request, response);
		
		Group group = GroupDao.selectGroupById(new Integer(id));
		group.setGroupType(GroupTypeDao.selectGroupTypeById(group.getGroupTypeId()));
		
		request.setAttribute("group", group);
		return "success";
	}
}
